using System;
using System.Xml.Serialization;
using System.IO;

namespace JAMR
{
	public class JAMRSettings
	{
		// Properties
		public string MinecraftWorld {
			get;
			set;
		}
		
		// Constructor
		public JAMRSettings ()
		{
		}
		
		// Methods
        public static JAMRSettings Load(string path) 
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(JAMRSettings));
            TextReader textReader = new StreamReader(path);

            JAMRSettings settings;
            settings = (JAMRSettings)deserializer.Deserialize(textReader);
            textReader.Close();

            return settings;
        }
        public void Save(string path) 
        {
            XmlSerializer serializer = new XmlSerializer(typeof(JAMRSettings));

            XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
            namespaces.Add(string.Empty, string.Empty);

            TextWriter textWriter = new StreamWriter(path);
            serializer.Serialize(textWriter, this, namespaces);
            textWriter.Close();
        }
	}
}
